Fix GeoGrid OVL V2.0 Unknown subtype (17)
authorRalf Horstmann <ralf+github@ackstorm.de>
Wed, 15 Feb 2017 19:02:02 +0000 (20:02 +0100)
committerRalf Horstmann <ralf+github@ackstorm.de>
Wed, 15 Feb 2017 19:02:02 +0000 (20:02 +0100)
Fixes issue #66.

OVL V2.0 files contain the additional text field for all subtype
values != 1, not just for subtype 0x10. The V3.0 and V4.0 readers
do handle this correctly already.

Add a test case that exposes the bug.

Change bincompare to compare for the gpx output files in the
ggv_bin test cases while there.

ggv_bin.cc
reference/ggv_bin-sample-v2.gpx [new file with mode: 0644]
reference/ggv_bin-sample-v2.ovl [new file with mode: 0644]
testo.d/ggv_bin.test

index 9a616cfe573f1f434333e34619348e027e068838..6c87e2dc37167e1da04bf12c898f6c61a579407b 100644 (file)
@@ -143,17 +143,9 @@ ggv_bin_read_v2(QDataStream& stream)
     ggv_bin_read16(stream, "entry zoom");
     entry_subtype = ggv_bin_read16(stream, "entry subtype");
 
-    switch (entry_subtype) {
-    case 0x01:
-      // no data following
-      break;
-    case 0x10:
-      // text with 32 bit length field follows
+    if (entry_subtype != 1) {
       ggv_bin_read_text32(stream, buf, "text len");
       track_name = QString::fromLatin1(buf.constData()).simplified();
-      break;
-    default:
-      fatal(MYNAME ": Unknown subtype (%hu)\n", entry_subtype);
     }
 
     switch (entry_type) {
diff --git a/reference/ggv_bin-sample-v2.gpx b/reference/ggv_bin-sample-v2.gpx
new file mode 100644 (file)
index 0000000..887b03e
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gpx version="1.0" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/0">
+  <time>1970-01-01T00:00:00Z</time>
+  <bounds minlat="48.270182777" minlon="11.123582605" maxlat="48.272877253" maxlon="11.131655554"/>
+  <trk>
+    <trkseg>
+      <trkpt lat="48.270464676" lon="11.126680138"/>
+      <trkpt lat="48.270388035" lon="11.128432438"/>
+      <trkpt lat="48.270399219" lon="11.129913865"/>
+      <trkpt lat="48.270588124" lon="11.131122911"/>
+      <trkpt lat="48.270951717" lon="11.131655554"/>
+      <trkpt lat="48.271741381" lon="11.129083025"/>
+      <trkpt lat="48.271821089" lon="11.127734716"/>
+      <trkpt lat="48.272355299" lon="11.127052185"/>
+      <trkpt lat="48.272707696" lon="11.126103325"/>
+      <trkpt lat="48.272877253" lon="11.124753460"/>
+      <trkpt lat="48.272425789" lon="11.124491733"/>
+      <trkpt lat="48.271704673" lon="11.124234594"/>
+      <trkpt lat="48.271163324" lon="11.123974406"/>
+      <trkpt lat="48.270441183" lon="11.123582605"/>
+      <trkpt lat="48.270182777" lon="11.125068613"/>
+      <trkpt lat="48.270464676" lon="11.126680138"/>
+    </trkseg>
+  </trk>
+</gpx>
diff --git a/reference/ggv_bin-sample-v2.ovl b/reference/ggv_bin-sample-v2.ovl
new file mode 100644 (file)
index 0000000..04f98fe
Binary files /dev/null and b/reference/ggv_bin-sample-v2.ovl differ
index 9351091c4ed00c947b97a1b805eafb315d6c3e5b..2f672477aa9a1061c70c54ba43e18ff479425020 100644 (file)
@@ -2,5 +2,7 @@
 # Geogrid-Viewer binary overlay files
 #
 rm -f ${TMPDIR}/ggv_bin*
+gpsbabel -i ggv_bin -f ${REFERENCE}/ggv_bin-sample-v2.ovl -o gpx -F ${TMPDIR}/ggv_bin-sample-v2.gpx
+compare ${REFERENCE}/ggv_bin-sample-v2.gpx ${TMPDIR}/ggv_bin-sample-v2.gpx
 gpsbabel -i ggv_bin -f ${REFERENCE}/ggv_bin-sample-v3.ovl -o gpx -F ${TMPDIR}/ggv_bin-sample-v3.gpx
-bincompare ${REFERENCE}/ggv_bin-sample-v3.gpx ${TMPDIR}/ggv_bin-sample-v3.gpx
+compare ${REFERENCE}/ggv_bin-sample-v3.gpx ${TMPDIR}/ggv_bin-sample-v3.gpx